// SPDX-License-Identifier: GPL-2.0
/dts-v1/;

#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/input/gpio-keys.h>

#include "tegra194-p2888.dtsi"

/ {
	model = "NVIDIA Jetson AGX Xavier Developer Kit";
	compatible = "nvidia,p2972-0000", "nvidia,tegra194";

	bus@0 {
		aconnect@2900000 {
			status = "okay";

			dma-controller@2930000 {
				status = "okay";
			};

			interrupt-controller@2a40000 {
				status = "okay";
			};
		};

		ddc: i2c@31c0000 {
			status = "okay";
		};

		/* SDMMC1 (SD/MMC) */
		mmc@3400000 {
			status = "okay";
		};

		hda@3510000 {
			nvidia,model = "jetson-xavier-hda";
			status = "okay";
		};

		padctl@3520000 {
			status = "okay";

			pads {
				usb2 {
					lanes {
						usb2-1 {
							status = "okay";
						};

						usb2-3 {
							status = "okay";
						};
					};
				};

				usb3 {
					lanes {
						usb3-0 {
							status = "okay";
						};

						usb3-3 {
							status = "okay";
						};
					};
				};
			};

			ports {
				usb2-1 {
					mode = "host";
					status = "okay";
				};

				usb2-3 {
					mode = "host";
					status = "okay";
				};

				usb3-0 {
					nvidia,usb2-companion = <1>;
					status = "okay";
				};

				usb3-3 {
					nvidia,usb2-companion = <3>;
					maximum-speed = "super-speed";
					status = "okay";
				};
			};
		};

		usb@3610000 {
			status = "okay";

			phys =	<&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-1}>,
				<&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-3}>,
				<&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-0}>,
				<&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-3}>;
			phy-names = "usb2-1", "usb2-3", "usb3-0", "usb3-3";
		};

		pwm@c340000 {
			status = "okay";
		};

		host1x@13e00000 {
			display-hub@15200000 {
				status = "okay";
			};

			dpaux@155c0000 {
				status = "okay";
			};

			dpaux@155d0000 {
				status = "okay";
			};

			dpaux@155e0000 {
				status = "okay";
			};

			/* DP0 */
			sor@15b00000 {
				status = "okay";

				avdd-io-hdmi-dp-supply = <&vdd_1v0>;
				vdd-hdmi-dp-pll-supply = <&vdd_1v8hs>;

				nvidia,dpaux = <&dpaux0>;
			};

			/* DP1 */
			sor@15b40000 {
				status = "okay";

				avdd-io-hdmi-dp-supply = <&vdd_1v0>;
				vdd-hdmi-dp-pll-supply = <&vdd_1v8hs>;

				nvidia,dpaux = <&dpaux1>;
			};

			/* HDMI */
			sor@15b80000 {
				status = "okay";

				avdd-io-hdmi-dp-supply = <&vdd_1v0>;
				vdd-hdmi-dp-pll-supply = <&vdd_1v8hs>;
				hdmi-supply = <&vdd_hdmi>;

				nvidia,ddc-i2c-bus = <&ddc>;
				nvidia,hpd-gpio = <&gpio TEGRA194_MAIN_GPIO(M, 2)
							 GPIO_ACTIVE_LOW>;
			};
		};
	};

	pcie@14100000 {
		status = "okay";

		vddio-pex-ctl-supply = <&vdd_1v8ao>;

		phys = <&p2u_hsio_0>;
		phy-names = "p2u-0";
	};

	pcie@14140000 {
		status = "okay";

		vddio-pex-ctl-supply = <&vdd_1v8ao>;

		phys = <&p2u_hsio_7>;
		phy-names = "p2u-0";
	};

	pcie@14180000 {
		status = "okay";

		vddio-pex-ctl-supply = <&vdd_1v8ao>;

		phys = <&p2u_hsio_2>, <&p2u_hsio_3>, <&p2u_hsio_4>,
		       <&p2u_hsio_5>;
		phy-names = "p2u-0", "p2u-1", "p2u-2", "p2u-3";
	};

	pcie@141a0000 {
		status = "okay";

		vddio-pex-ctl-supply = <&vdd_1v8ao>;
		vpcie3v3-supply = <&vdd_3v3_pcie>;
		vpcie12v-supply = <&vdd_12v_pcie>;

		phys = <&p2u_nvhs_0>, <&p2u_nvhs_1>, <&p2u_nvhs_2>,
		       <&p2u_nvhs_3>, <&p2u_nvhs_4>, <&p2u_nvhs_5>,
		       <&p2u_nvhs_6>, <&p2u_nvhs_7>;

		phy-names = "p2u-0", "p2u-1", "p2u-2", "p2u-3", "p2u-4",
			    "p2u-5", "p2u-6", "p2u-7";
	};

	pcie_ep@141a0000 {
		status = "disabled";

		vddio-pex-ctl-supply = <&vdd_1v8ao>;

		reset-gpios = <&gpio TEGRA194_MAIN_GPIO(GG, 1) GPIO_ACTIVE_LOW>;

		nvidia,refclk-select-gpios = <&gpio_aon TEGRA194_AON_GPIO(AA, 5)
					      GPIO_ACTIVE_HIGH>;

		phys = <&p2u_nvhs_0>, <&p2u_nvhs_1>, <&p2u_nvhs_2>,
		       <&p2u_nvhs_3>, <&p2u_nvhs_4>, <&p2u_nvhs_5>,
		       <&p2u_nvhs_6>, <&p2u_nvhs_7>;

		phy-names = "p2u-0", "p2u-1", "p2u-2", "p2u-3", "p2u-4",
			    "p2u-5", "p2u-6", "p2u-7";
	};

	fan: fan {
		compatible = "pwm-fan";
		pwms = <&pwm4 0 45334>;

		cooling-levels = <0 64 128 255>;
		#cooling-cells = <2>;
	};

	gpio-keys {
		compatible = "gpio-keys";

		force-recovery {
			label = "Force Recovery";
			gpios = <&gpio TEGRA194_MAIN_GPIO(G, 0)
				       GPIO_ACTIVE_LOW>;
			linux,input-type = <EV_KEY>;
			linux,code = <KEY_SLEEP>;
			debounce-interval = <10>;
		};

		power {
			label = "Power";
			gpios = <&gpio_aon TEGRA194_AON_GPIO(EE, 4)
					   GPIO_ACTIVE_LOW>;
			linux,input-type = <EV_KEY>;
			linux,code = <KEY_POWER>;
			debounce-interval = <10>;
			wakeup-event-action = <EV_ACT_ASSERTED>;
			wakeup-source;
		};
	};

	thermal-zones {
		cpu {
			polling-delay = <0>;
			polling-delay-passive = <500>;
			status = "okay";

			trips {
				cpu_trip_critical: critical {
					temperature = <96500>;
					hysteresis = <0>;
					type = "critical";
				};

				cpu_trip_hot: hot {
					temperature = <70000>;
					hysteresis = <2000>;
					type = "hot";
				};

				cpu_trip_active: active {
					temperature = <50000>;
					hysteresis = <2000>;
					type = "active";
				};

				cpu_trip_passive: passive {
					temperature = <30000>;
					hysteresis = <2000>;
					type = "passive";
				};
			};

			cooling-maps {
				cpu-critical {
					cooling-device = <&fan 3 3>;
					trip = <&cpu_trip_critical>;
				};

				cpu-hot {
					cooling-device = <&fan 2 2>;
					trip = <&cpu_trip_hot>;
				};

				cpu-active {
					cooling-device = <&fan 1 1>;
					trip = <&cpu_trip_active>;
				};

				cpu-passive {
					cooling-device = <&fan 0 0>;
					trip = <&cpu_trip_passive>;
				};
			};
		};

		gpu {
			polling-delay = <0>;
			polling-delay-passive = <500>;
			status = "okay";

			trips {
				gpu_alert0: critical {
					temperature = <99000>;
					hysteresis = <0>;
					type = "critical";
				};
			};
		};

		aux {
			polling-delay = <0>;
			polling-delay-passive = <500>;
			status = "okay";

			trips {
				aux_alert0: critical {
					temperature = <90000>;
					hysteresis = <0>;
					type = "critical";
				};
			};
		};
	};
};
